-
-
Notifications
You must be signed in to change notification settings - Fork 871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix that zero-byte files do not have a hash as reported by the OneDrive API thus should not generate an error message #2436
Conversation
abraunegg
commented
Jun 20, 2023
- The OneDrive API does not present a hash for all files, most notably those that are zero byte in size (this may be fixed in the future). Add a wrapper to the existing makeItem function to test the file size before working out if this is a going to be a problem and then print out an error message if the file size is greater than 0
…ve API * The OneDrive API does not present a hash for all files, most notably those that are zero byte in size (this may be fixed in the future). Add a wrapper to the existing makeItem function to test the file size before working out if this is a going to be a problem and then print out an error message if the file size is greater than 0
Testing Evidence
With a slight tweak locally to actually print a message on a known zero byte file .. this PR is known to be working as intended. |
Hello @abraunegg, After updating from 2.4.23 to 2.4.25 (local build), I'm getting LOTS of warnings about files that don't have a hash (warning introduced in commit 268dcf9 for this issue). They look like this:
edit: I'm not sure what the intent of the commit was: To avoid errors that used to happen with empty files that do not have a hash, or to add this warning for non-empty files that do not have a hash. If the latter, then this is expected I guess, but quite scary when you see all of those new warnings :-) If the former, unless there's something special with my files, this might happen to lots of people and might generate a lot of requests for help here, so thought I'd give you a heads-up. Even if this is a "safe" warning, i.e. nothing bad will happen when it pops up, there are so many of them that it pollutes the output in a way that I'm afraid might hide "real" errors. Let me know if this is already known or expected - otherwise, here's some more info:
I'm not attaching a whole log here as it's huge with the extra verbose output. Also I don't know if it contains any sensitive info. Let me know if you'd like me to do anything else (opening a new issue, sending parts of a log, trying different things like a sync from scratch, trying some changes in the code - I'm not at all familiar with the OneDrive API but can try things if you point me in the right direction)... (and thanks for your amazing work on this :-)) |
@yapakipe In v2.5.0 the checks have been enhanced further to check the mime type, thus if the mime type is for OneNote items no message is printed. For the non-zero byte files you must open a bug report with Microsoft - I cannot fix their broken API. |
Thanks @abraunegg. Meanwhile I had a look at the code and recent changes and tried a couple of things, and I now understand a bit more - hope you won't mind my spamming this issue a bit more with some info for other people who might be wondering about this: The sha1 hash being deprecated in the API and replaced with quickXorHash, and MS is encouraging people to make the change prior to the deprecation actually taking place (in July 2023). These recent changes @abraunegg made were exactly that. In my case, the files giving the warnings have a valid sha1Hash, which is now being ignored by this onedrive client as per MS' recommendation. The problem is they do not (yet?) have a quickXorHash, which as @abraunegg said is a problem on the MS side: If they say you should change your code now, then they need to make sure the data is ready for this updated code. This doc says "In some cases hash values may not be available. If this is the case, the hash values on an item will be updated after the item is downloaded.", but that doesn't seem to be working (at least for some files) as the warnings keep appearing. This doesn't seem to affect the proper downloading of the files by this onedrive client - other than maybe re-downloading a file that wouldn't need to be. I might just wait and see if these files get a quickXorHash at some point, and if not, I'll reach out to OneDrive support... Thanks again @abraunegg! |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |